Se si inseriscono dei campi in un request form di un dataport, scompaiono le ozpioni "import\export" e "filename"
utilizzare : CurrDataport.FILENAME; CurrDataport.IMPORT (TRUE\FALSE) , utilizzare control box con 2 opzioni e variabile Filename
es:dataport import "Sales Price" con filtro Tipo Listino Input\Output
codice txt
OBJECT Dataport 50032 Import/Export Price List
{
OBJECT-PROPERTIES
{
Date=06/11/09;
Time=17.30.10;
Modified=Yes;
Version List=;
}
PROPERTIES
{
CaptionML=[ENU=Import/Export Price List;
ITA=Importa/Esporta Listino];
FieldSeparator=<TAB>;
UseReqForm=Yes;
OnInitDataport=BEGIN
NomeFile := CurrDataport.FILENAME;
END;
OnPreDataport=BEGIN
CurrDataport.FILENAME := NomeFile;
CurrDataport.IMPORT(Import);
END;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table7002;
AutoReplace=Yes;
DataItemTableView=SORTING(Item No.,Sales Type,Sales Code,Starting Date,Currency Code,Variant Code,Unit of Measure Code,Minimum Quantity) ORDER(Ascending);
ReqFilterFields=;
OnPreDataItem=BEGIN
SETRANGE("Sales Type","Sales Price"."Sales Type"::"Customer Price Group");
IF NOT Import THEN
SETRANGE("Sales Code",StartSalesCode);
END;
OnAfterImportRecord=BEGIN
IF DestSalesCode <> '' THEN
"Sales Code" := DestSalesCode;
IF COMPANYNAME = 'Ermanno Scervino Limited' THEN
IF "Currency Code" = 'GBP' THEN
"Currency Code" := '';
//if companyname = 'DERNAMARIA' then
// if "Currency Code" = '' then
END;
}
FIELDS
{
{ 1 ;20 ;"Item No." }
{ 22 ;20 ;"Sales Code" }
{ 43 ;10 ;"Currency Code" }
{ 54 ;11 ;"Starting Date" }
{ 66 ;12 ;"Unit Price" }
{ 79 ;10 ;"Price Includes VAT" }
{ 90 ;10 ;"Allow Invoice Disc." }
{ 101 ;10 ;"VAT Bus. Posting Gr. (Price)" }
{ 112 ;10 ;"Sales Type" }
{ 123 ;12 ;"Minimum Quantity" }
{ 136 ;11 ;"Ending Date" }
{ 148 ;10 ;"Unit of Measure Code" }
{ 159 ;10 ;"Variant Code" }
{ 170 ;10 ;"Allow Line Disc." }
{ 181 ;10 ;Theme }
{ 192 ;10 ;Season }
{ 203 ;100 ;"Descr item" }
{ 304 ;10 ;"PfsVertical Component" }
{ 315 ;10 ;"PfsHorizontal Component" }
{ 326 ;12 ;"Cost Costing Card" }
{ 339 ;12 ;"PfsList Price" }
{ 352 ;40 ;PfsSorting }
{ 393 ;10 ;"PfsSubsidiary Code" }
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=9240;
Height=3410;
OnOpenForm=BEGIN
NomeFile:= 'C:\listino.txt';
END;
}
CONTROLS
{
{ 1000000000;TextBox;3520 ;2640 ;2310 ;440 ;ValidateTableRelation=Yes;
Lookup=Yes;
AssistEdit=No;
PermanentAssist=No;
SourceExpr=StartSalesCode;
AutoCalcField=Yes;
TableRelation="Customer Price Group" }
{ 1000000001;Label ;110 ;2640 ;3300 ;440 ;CaptionML=ITA=Codice Vendita }
{ 1000000002;TextBox;3630 ;110 ;5500 ;440 ;Name=FileName;
CaptionML=[ENU=File Name;
ITA=Nome File];
SourceExpr=NomeFile;
OnAssistEdit=VAR
CommonDialogMgt@1001 : Codeunit 412;
BEGIN
IF Import THEN
NomeFile := CommonDialogMgt.OpenFile(Text1003,NomeFile,1,'',0)
ELSE
NomeFile := CommonDialogMgt.OpenFile(Text1003,NomeFile,1,'',1);
END;
}
{ 1000000003;OptionButton;3630;770;3740;440 ;CaptionML=[ENU=Import;
ITA=Importa];
SourceExpr=Import;
OptionValue=Yes }
{ 1000000004;OptionButton;3630;1320;3740;440;CaptionML=[ENU=Export;
ITA=Esporta];
SourceExpr=Import;
OptionValue=No }
{ 1000000005;Label ;110 ;110 ;3300 ;440 ;CaptionML=[ENU=File Name;
ITA=Nome File] }
{ 1000000006;Label ;110 ;770 ;3300 ;440 ;CaptionML=[ENU=Direction;
ITA=Direzione] }
{ 1000000008;Label ;3960 ;2090 ;1430 ;440 ;FontBold=Yes;
CaptionML=[ENU=Start;
ITA=Partenza] }
{ 1000000009;Label ;7150 ;2090 ;990 ;440 ;FontBold=Yes;
CaptionML=[ENU=Destination;
ITA=Arrivo] }
{ 1000000007;TextBox;6490 ;2640 ;2310 ;440 ;ValidateTableRelation=Yes;
Lookup=Yes;
AssistEdit=No;
PermanentAssist=No;
SourceExpr=DestSalesCode;
AutoCalcField=Yes;
TableRelation="Customer Price Group" }
}
}
CODE
{
VAR
StartSalesCode@1000000000 : Code[20];
DestSalesCode@1000000005 : Code[20];
NomeFile@1000000001 : Text[1024];
CommonDialogMgt@1000000002 : Codeunit 412;
Text1003@1000000003 : TextConst 'ITA=Listino';
Import@1000000004 : Boolean;
BEGIN
END.
}
}